import { getList, getMenu } from '../api'
import actionsType from './actionsType'
const actions = {
  getList() {
    return async diapatch => {
      const resp = await getList()
      diapatch({ type: actionsType.SET_LIST, payload: resp.data.data })
    }
  },
  getMenu() {
    return async diapatch => {
      const resp = await getMenu()
      diapatch({ type: actionsType.SET_MENU, payload: resp.data.data })
    }
  },
  addMess(payload) {
    return { type: actionsType.ADD_MESS, payload }
  },
  switchCode(payload) {
    return { type: actionsType.SWITCH_CODE, payload }
  }
}


export default actions